package com.an.blog.web.controller;

import cn.dev33.satoken.annotation.SaIgnore;
import cn.hutool.core.bean.BeanUtil;
import com.an.blog.web.domain.vo.BlogNoticeWebVo;
import com.an.common.core.domain.R;
import com.an.system.domain.SysNotice;
import com.an.system.service.ISysNoticeService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 博客通知网页控制器
 *
 * @author: Ann
 * @createDate: 2024/01/03 17:02:14
 * @version: 1.0.0
 */
@RestController
@RequestMapping("/blog-web/notice")
@RequiredArgsConstructor
public class BlogNoticeWebController {

    private final ISysNoticeService sysNoticeService;


    /**
     * 查询网页通知
     *
     * @return {@link R }<{@link BlogNoticeWebVo }>
     * @author: Ann
     * @createDate: 2024/01/03 17:13:06
     * @version: 1.0.0
     */
    @SaIgnore
    @GetMapping("/queryNotice")
    public R<BlogNoticeWebVo> queryWebNotice() {
        SysNotice sysNotice = sysNoticeService.queryWebNotice();
        BlogNoticeWebVo blogNoticeWebVo = BeanUtil.toBean(sysNotice, BlogNoticeWebVo.class);
        return R.ok(blogNoticeWebVo);
    }
}
